// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#include "targetver.h"

#define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>

// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>

#include <WinSock2.h>
#include <WS2tcpip.h>
#pragma comment (lib, "Ws2_32.lib")

// TODO: reference additional headers your program requires here
// opengl header files
//#include <gl\GL.h>
//#include <gl\GLU.h>
//
//#pragma comment(lib, "opengl32.lib")
//#pragma comment(lib, "glu32.lib")

// directx11
//#include <direct.h>
//#include <d3d11_1.h>
//#include <d3dcompiler.h>
//#include <directxmath.h>
//#include <directxcolors.h>

#include <cassert>
#include <stdio.h>
#include <exception>

int wsa_error_handling(const char* message)
{
	size_t len = strlen(message);
	assert(len < 128);
	int iRet = WSAGetLastError();
	char buf[128] = { 0 };
	sprintf_s(buf, "WSA error %d: %s.", iRet, message);
	OutputDebugString(buf);
	throw std::exception(buf);
	return iRet;
}

void info_handling(const char* message)
{
	size_t len = strlen(message);
	assert(len < 128);
	char buf[128] = { 0 };
	sprintf_s(buf, "INFO : %s.", message);
	OutputDebugString(buf);
}